// vuex 小仓库
//存储数据的
import { reqCategoryList,reGetBannerList,reGetFloorList} from "@/api/index"

const state={
  reqCategoryList:[],
  reGetBannerList:[],
  reGetFloorList:[]
}  
//唯一修改state数据的
const mutations={
  CATEGORYLIST(state,reqCategoryList){
    state.reqCategoryList=reqCategoryList
  },
  GETBANNER(state,reGetBannerList){
    state.reGetBannerList=reGetBannerList
  },
  GETFLOORLIST(state,reGetFloorList){
    state.reGetFloorList=reGetFloorList
  }

}
// 在里面可以写自己的逻辑 
const actions={
  async categoryList({commit}){
    let result= await reqCategoryList()
    
     if(result.code==200){
       commit("CATEGORYLIST",result.data)
     }
  },
  async GetBanner({commit}){
       let result=await reGetBannerList()
      
       if(result.code==200){
          commit("GETBANNER",result.data)
        }
  },
 async GetFloorList({commit}){
     let result=await reGetFloorList()
     if(result.code==200){
      commit("GETFLOORLIST",result.data)
     }
   
  }
  
}
//理解为计算属性
const getters={}
export default {
  getters,
  mutations,
  actions,
  state,

}